package com.king.edu.filter;

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;

/**
 * @ClassName: TransportIPFilter
 * @Description: TODO
 * @Author: wangchangyong
 * @Date: 2020/6/10 10:18
 * @Version: 1.0.0
 **/
// @Activate(group = {CommonConstants.PROVIDER})
public class TransportIPFilter implements Filter {

    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        System.out.println("consumer request address = " + RpcContext.getContext().getAttachment("requestIp"));
        return invoker.invoke(invocation);
    }
}
